- unless resource.new_record?
  .contextual
    .btn-group
      %button.btn= t_action(:book_manual)
      %button.btn.dropdown-toggle{'data-toggle' => 'dropdown'}
        %span.caret
      %ul.dropdown-menu.pull-right
        - BookingTemplate.tagged_with('use:credit_invoice').each do |template|
          %li= link_to template.title, new_invoice_simple_booking_path(resource, :booking_template_id => template.id), 'data-remote' => true

=  simple_form_for resource do |f|
  = f.input :customer_id, :as => :hidden
  .row-fluid
    .span6= f.input :title
    .span6= f.input :code
  .row-fluid
    .span6= f.association :company, :as => :combobox, :input_html => {'data-autofocus' => true}
    .span6= f.input :state, :collection => invoice_states_as_collection
  .row-fluid
    .span6= f.input :value_date, :as => :date_field
    .span6= f.input :due_date, :as => :date_field
  .row-fluid
    .span6= f.input :duration_from, :as => :date_field
    .span6= f.input :duration_to, :as => :date_field
  .row-fluid
    .span12= f.input :remarks, :input_html => {:rows => 4}

  = render 'line_items/list_form', :f => f, :invoice => resource

  .form-actions
    = f.button :submit
